/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.feiyue.helper;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import java.io.File;
import java.io.IOException;
import org.apache.http.HttpResponse;
import org.apache.http.StatusLine;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.FileEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpConnectionParams;

public class Thread2SendFavoriteReport extends Thread {
	private Context context;
	private String url;

	public Thread2SendFavoriteReport(Context paramContext, String paramString) {
		this.context = paramContext;
		this.url = paramString;
	}

	public int checkNet(Context paramContext) {
		int i = -1;
		NetworkInfo localNetworkInfo = ((ConnectivityManager) paramContext
				.getSystemService("connectivity")).getActiveNetworkInfo();
		if (localNetworkInfo != null) {
			if (!(localNetworkInfo.isAvailable()))
				return i;
			i = localNetworkInfo.getType();
		}
		return i;
	}

	public void run() {
		sendFile2Server(this.context, this.url, "null", 0);
	}

	public boolean sendFile2Server(Context paramContext, String paramString1,
			String paramString2, int paramInt) {
//		if (checkNet(paramContext) == -1)
//			return false;
//		HttpPost localHttpPost = new HttpPost(paramString1);
//		if ((paramString2 != null) && (!(paramString2.equals("null")))) {
//			File localFile = new File(paramString2);
//			if (!(localFile.exists()))
//				return true;
//			localHttpPost.setEntity(new FileEntity(localFile,
//					"binary/octet-stream"));
//		}
//		try {
//			BasicHttpParams localBasicHttpParams = new BasicHttpParams();
//			HttpConnectionParams.setConnectionTimeout(localBasicHttpParams,
//					30000);
//			HttpConnectionParams.setSoTimeout(localBasicHttpParams, 20000);
//			DefaultHttpClient localDefaultHttpClient = new DefaultHttpClient();
//			if (!(paramString2.equals("null"))) {
//				localObject = localDefaultHttpClient.execute(localHttpPost);
//				if (((HttpResponse) localObject).getStatusLine()
//						.getStatusCode() == 200)
//					;
//				return true;
//			}
//			HttpResponse localHttpResponse = localDefaultHttpClient
//					.execute(new HttpGet(paramString1));
//			Object localObject = localHttpResponse;
//		} catch (Exception localException) {
//			return false;
//		} catch (IllegalStateException localIllegalStateException) {
//			return false;
//		} catch (IOException localIOException) {
//			return false;
//		} catch (ClientProtocolException localClientProtocolException) {
//		}
		return false;
	}
}